package com.hyt.it.ogt.kq.service.govData.service.kz.impl;


import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hyt.core.base.BaseServiceImpl;
import com.hyt.it.ogt.kq.service.govData.mapper.kz.ExamCandidateInfoMapper;
import com.hyt.it.ogt.kq.service.govData.model.entity.kz.ExamCandidateInfo;
import com.hyt.it.ogt.kq.service.govData.service.kz.IExamCandidateInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 考生信息 服务实现类
 * </p>
 *
 * @author 刘恒活
 * @since 2020-05-15
 */
@Service
public class ExamCandidateInfoServiceImpl extends BaseServiceImpl<ExamCandidateInfoMapper, ExamCandidateInfo> implements IExamCandidateInfoService {


    /**
     * 批量保存
     * @param records
     * @return
     */
    @Override
    public Boolean batchSave(List<ExamCandidateInfo> records){
        return baseMapper.saveBatch(records) > 0;
    }

    /**
     * 删除根据考试id
     * @param examIds
     * @return
     */
    @Override
    @DS("kz")
    public Boolean removeByExamIds(List<String> examIds){
        LambdaQueryWrapper<ExamCandidateInfo> queryExamCandidateInfoWrapper = Wrappers.lambdaQuery();
        queryExamCandidateInfoWrapper.in(ExamCandidateInfo::getExamId, examIds);
        return this.remove(queryExamCandidateInfoWrapper);
    }
}

